In addition, each "word" within a class name should start
with an uppercase letter.
For example, TwoDimensionalPoint
is an
appropriate type names.
Further, each "word" within a variable name should start
with an uppercase letter.
For example, importantMessage
and
campusMonitor
are both appropriate variable names.
In general, even single-character variable names should be lowercase. However, in some situations, mathematical notation uses uppercase letters. In such situations, uppercase variable names may be used. For example, matrices are often written using uppercase letters. So, an expression like (b = A*x) would be appropriate.
Variable names like aaa
are not appropriate.
Index variables and counters can, however, have names like
i
and j
.
The only exception to this rule is index variables in loops, which may be declared locally.
For example, variables of type double
should be declared
before variables of type int
which should, in turn,
be declared before variables of type Node
.
No particular indentation scheme is required but you must indent your code in a meaningful and consistent way.
The Javadoc format is preferred, but not required.
.h
file and
function comments must be in the .c
file.
Since Doxygen combines comments from both types of files, this approach works for both people that do and don't have access to the source.
It must also attest to your compliance with the JMU Honor Code.
It must also list any side effects.
There are also several books devoted to C style, including:
Ranade,
J.
and
A. Nash
(1992)
The Elements of C Programming Style, McGraw Hill
, Boston.
(Order from
amazon
, order from
Barnes and Noble
, compare at
bigwords
, compare at
CampusBooks4Less
, order from
Chegg
, or search
eFollett
)
Copyright 2019